/**
 * 
 */
package tests.board.pieces;

import junit.framework.TestCase;

import org.junit.After;
import org.junit.AfterClass;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;

import root.JChess;
import root.board.moviment.Moviment;
import root.board.pieces.King;

/**
 * @author Calebe
 * 
 */
public class KingTest extends TestCase {

	/**
	 * @throws java.lang.Exception
	 */
	@BeforeClass
	public static void setUpBeforeClass() throws Exception {
	}

	/**
	 * @throws java.lang.Exception
	 */
	@AfterClass
	public static void tearDownAfterClass() throws Exception {
	}

	private JChess jchess;

	/**
	 * @throws java.lang.Exception
	 */
	@Override
	@Before
	public void setUp() throws Exception {
	}

	/**
	 * @throws java.lang.Exception
	 */
	@Override
	@After
	public void tearDown() throws Exception {
	}

	@Test
	public void testEstBlocked() {
		King playKing = new King();
		playKing.setMoved(true);
		Moviment[] moviment = playKing.moviments(7, 4);
		assertEquals(5, moviment.length);

	}

	@Test
	/**
	 * 
	 */
	public void testFreeKing() {
		King playKing = new King();
		playKing.setMoved(true);
		Moviment[] moviment = playKing.moviments(4, 4);
		assertEquals(8, moviment.length);
	}

	@Test
	public void testNorthBlocked() {
		King playKing = new King();
		playKing.setMoved(true);
		Moviment[] moviment = playKing.moviments(4, 0);
		assertEquals(5, moviment.length);

	}

	@Test
	public void testNorthBlockedUnmoved() {
		King playKing = new King();
		Moviment[] moviment = playKing.moviments(4, 0);
		assertEquals(7, moviment.length);

	}

	@Test
	public void testNorthEastBlocked() {
		King playKing = new King();
		playKing.setMoved(true);
		Moviment[] moviment = playKing.moviments(7, 0);
		assertEquals(3, moviment.length);

	}

	@Test
	public void testNorthWestBlocked() {
		King playKing = new King();
		playKing.setMoved(true);
		Moviment[] moviment = playKing.moviments(0, 0);
		assertEquals(3, moviment.length);

	}

	@Test
	public void testSouthBlocked() {
		King playKing = new King();
		playKing.setMoved(true);
		Moviment[] moviment = playKing.moviments(4, 7);
		assertEquals(5, moviment.length);

	}

	@Test
	public void testSouthBlockedUnmoved() {
		King playKing = new King();
		Moviment[] moviment = playKing.moviments(4, 7);
		assertEquals(7, moviment.length);

	}

	@Test
	public void testSouthEastBlocked() {
		King playKing = new King();
		playKing.setMoved(true);
		Moviment[] moviment = playKing.moviments(7, 7);
		assertEquals(3, moviment.length);

	}

	@Test
	public void testSouthWestBlocked() {
		King playKing = new King();
		playKing.setMoved(true);
		Moviment[] moviment = playKing.moviments(0, 7);
		assertEquals(3, moviment.length);

	}

	@Test
	public void testWestBlocked() {
		King playKing = new King();
		playKing.setMoved(true);
		Moviment[] moviment = playKing.moviments(0, 4);
		assertEquals(5, moviment.length);

	}

}
